package com.knowif.service;

import com.knowif.dao.StanderSorceMapper;
import com.knowif.pojo.StanderSorce;
import com.knowif.pojo.StanderSorceExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Xh
 * @date ：Created in 2019/5/4 0004 21:28
 */
@Service
public class StanderSorce_service {

    @Autowired
    private StanderSorceMapper standerSorceMapper;

    /**
     * 条件统计
     * @param standerSorceExample
     * @return
     */
    public int countStanderSorceByParams(StanderSorceExample standerSorceExample){
        return standerSorceMapper.countByExample(standerSorceExample);
    }

    /**
     * 条件删除
     * @param standerSorceExample
     * @return
     */
    public int deleteStanderSorceByParams(StanderSorceExample standerSorceExample){
        return standerSorceMapper.deleteByExample(standerSorceExample);
    }

    /**
     * 插入不为空的
     * @param standerSorce
     * @return
     */
    public int saveStanderSorceNotNull(StanderSorce standerSorce){
        return standerSorceMapper.insertSelective(standerSorce);
    }

    /**
     * 通过主键查询
     * @param primaryKey
     * @return
     */
    public StanderSorce selectStanderSorceById(int primaryKey){
        return standerSorceMapper.selectByPrimaryKey(primaryKey);
    }

    /**
     * 通过参数更新不为空的
     * @param standerSorce
     * @param standerSorceExample
     * @return
     */
    public int updateStanderSorceNotNullByParams(StanderSorce standerSorce, StanderSorceExample standerSorceExample){
        return standerSorceMapper.updateByExampleSelective(standerSorce, standerSorceExample);
    }

    /**
     * 通过参数更新所有
     * @param standerSorce
     * @param standerSorceExample
     * @return
     */
    public int updateStanderSorceByParams(StanderSorce standerSorce, StanderSorceExample standerSorceExample) {
        return standerSorceMapper.updateByExample(standerSorce, standerSorceExample);
    }

    /**
     * StanderSorce条件查询
     * @param standerSorceExample
     * @return
     */
    public List<StanderSorce> selectStanderSorce(StanderSorceExample standerSorceExample){
        return standerSorceMapper.selectByExample(standerSorceExample);
    }

    /**
     * 插入standerSorce
     * @param standerSorce
     * @return
     */
    public int saveStanderSorce(StanderSorce standerSorce){
        return standerSorceMapper.insert(standerSorce);
    }

    /**
     * 插入StanderScore 返回主键
     * @param standerSorce
     * @return
     */
    public Integer saveStanderScore(StanderSorce standerSorce){
        int insert = standerSorceMapper.insert(standerSorce);
        return standerSorce.getId();
    }

    /**
     * 更新不为空的standerSorce属性
     * @param standerSorce
     * @return
     */
    public int updateStanderSorceNotNull(StanderSorce standerSorce){
        return standerSorceMapper.updateByPrimaryKeySelective(standerSorce);
    }

    /**
     * 更新所有standerSorce属性
     * @param standerSorce
     * @return
     */
    public int updateStanderSorce(StanderSorce standerSorce){
        return standerSorceMapper.updateByPrimaryKey(standerSorce);
    }

    /**
     * 删除standerSorce
     * @param standerSorceId
     */
    public int deleteStanderSorce(int standerSorceId){
        return standerSorceMapper.deleteByPrimaryKey(standerSorceId);
    }
}
